<template>
  <div>
    <div class="shopCard">
      <div class="shop-pic">
        <img :src="item.img"
             alt="">
      </div>
      <div class="shop-tell">
        <h3 class="shop-name">{{item.phone_name}}</h3>
        <p class="introduce">{{item.slogan}}</p>
        <p class="shop-price">￥{{item.default_price}}</p>
        <div>
          <button class="addCart"
                  @click="updateCartNum(true,item)">加入购物车</button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['item'],
  methods: {
    // 加入购物车
    updateCartNum (isAdd, good) {
      this.$store.dispatch('setCart', { isAdd, good })
    }
  }
}
</script>

<style lang="less" scoped>
.shopCard {
  height: 120px;
  width: 100%;
  border-bottom: 1px solid #ccc;
  background-color: #fff;
  height: 100%;
  .shop-pic {
    height: 100%;
    width: 120px;
    border-right: 1px solid #ccc;
    float: left;
    img {
      width: 100%;
    }
  }
  .shop-tell {
    height: 100%;
    overflow: hidden;
    position: relative;
    height: 120px;
    background-color: #fff;
    padding: 0 5px;
    .shop-name {
      font-size: 16px;
      font-weight: 550;
      padding-top: 10px;
    }
    .introduce {
      font-size: 14px;
      color: #999;
      margin: 10px 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .shop-price {
      color: red;
      font-size: 19px;
      font-weight: 550;
    }
    .addCart {
      border: 1px solid orange;
      background-color: #fff;
      font-size: 18px;
      color: orange;
      position: absolute;
      right: 10px;
      bottom: 10px;
    }
  }
}
</style>
